/******************************************************************
 * Title: scrunch.sc
 * Author:  Brian Peck
 * Date: Spring 2011
 * Description: Specification model for scrunch (in DES)
 *****************************************************************/
import "i_receiver";
import "i_sender";

behavior scrunch(i_reciever ir, i_sender is)
{
  void main(void) {
    unsigned char * outof;
    unsigned long * into;
    while (1) {
      ir.receive(&outof, sizeof(outof));
      *into      = (*outof++ & 0xffL) << 24;
      *into     |= (*outof++ & 0xffL) << 16;
      *into     |= (*outof++ & 0xffL) << 8;
      *into++   |= (*outof++ & 0xffL);
      *into      = (*outof++ & 0xffL) << 24;
      *into     |= (*outof++ & 0xffL) << 16;
      *into     |= (*outof++ & 0xffL) << 8;
      *into     |= (*outof   & 0xffL);
      ir.send(&into, sizeof(into));
    }
  } // end main
}// end behavior scrunch
